package com.boss.salary.service.impl;

import com.boss.salary.service.IRedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class RedisServiceImpl implements IRedisService {
    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public void put(String key,Object value) {
        key+= "salary";
        redisTemplate.opsForValue().set(key, value);
    }

    /**
     * <br>Description:TODO get 缓存
     */
    @Override
    public Object get(String key) {
        key+= "salary";
        return redisTemplate.opsForValue().get(key);
    }
    /**
     *  缓存删除
     * @param key
     */
    @Override
    public void del(String key) {
        key+= "salary";
        redisTemplate.delete(key);
    }
    /**
     * 以后缀删除
     * @param key
     */
    @Override
    public void Suffixdel(String key){
        redisTemplate.delete("*"+key );
    }

    /**
     * 模糊匹配删除
     * @param key
     */
    @Override
    public void Vaguedel(String key){
        redisTemplate.delete(key );
    }


}
